import request from "@/utils/request";
import { ActivityNodeTaskVO } from "./activityNodeTask.api";
import { IObject } from "../common/common";

const BASE_URL = "/system/flow";

const ActivityNodeAPI = {};

export default ActivityNodeAPI;

/** 实例节点对象 */
export interface ActivityNodeVO {
  /** ID */
  id: string;
  /** 实例ID */
  activityId: string;
  /** 名称 */
  name: string;
  /** 描述 */
  remark: string;
  /** 任务排序，编码等 */
  sort: number;
  /** 审核方式 */
  auditorType: string;
  /** 节点类型 */
  nodeType: string;
  /** 状态 */
  status: string;
  /** 审核不过，回退到哪一个节点 */
  backNodeId: string;
  /** 创建时间 */
  createTime: string;
  /** 节点退回来源节点 */
  backFromNodeId: string;
  /** 节点完成时间 */
  endTime: string;
  tasks: ActivityNodeTaskVO[];
}

export interface ActivityNodeForm {
  /** ID */
  id: string;
  /** 名称 */
  name: string;
  /** 描述 */
  remark: string;
  /** 任务排序，编码等 */
  sort: number;
  /** 审核方式 */
  auditorType: string;
  /** 节点类型 */
  nodeType: string;
  /** 审核不过，回退到哪一个节点 */
  backNodeId?: string;
  /** 是否替换新的审核节点(排序时)，前端用 */
  isNewBackId?: boolean;
}

export enum ActivityNodeStatus {
  NOT_START = "NOT_START",
  PROCESSING = "PROCESSING",
  WAIT_SUBMIT = "WAIT_SUBMIT",
  COMPLETED = "COMPLETED",
}

export const ActivityNode_Status_Label: IObject = {
  [ActivityNodeStatus.NOT_START]: "未开始",
  [ActivityNodeStatus.PROCESSING]: "进行中",
  [ActivityNodeStatus.WAIT_SUBMIT]: "待提交",
  [ActivityNodeStatus.COMPLETED]: "已完成",
};
